package com.hl.card.credit.pub.entity;

import java.util.Date;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hl.card.credit.pub.model.PublicOrdersAllModel;
import com.hl.card.credit.pub.utils.CommonUtil;

/**
 * 正常业务订单表(同一订单内，每个人的业务信息除价格可以不同外，其他数据必须一致，否则必须下新订单)
 * 
 * @author wdf
 * 
 */
public class PublicOrders {
	/**
	 * 主键ID
	 */
	private Integer busines_order_id;

	/**
	 * 订单号
	 */
	private String order_code;

	/**
	 * 订单生成日期
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date create_date;

	/**
	 * 订单生成时间
	 */
	private Date order_time;

	/**
	 * 业务种类（1机票、2火车票,3酒店。。。)
	 */
	private String busines_species;

	/**
	 * 所属商户（商户代码）
	 */
	private String merchant_code;

	/**
	 * 订单来源（商户应用）
	 */
	private String source;

	/**
	 * 上级商户（与所属商户实行双级定位）
	 */
	private String cid_merchant;

	/**
	 * 所属客户（客户代码）
	 */
	private String customer_id;

	/**
	 * 订单状态
	 */
	private String order_status;

	/**
	 * 订单标签
	 */
	private String order_tag;
	
	
	
	private String link_type;   //推广链接类型
	
	
	private String link_merchantCode;   //推广链接商户
	
	

	public String getLink_type() {
		return link_type;
	}

	public void setLink_type(String link_type) {
		this.link_type = link_type;
	}

	public String getLink_merchantCode() {
		return link_merchantCode;
	}

	public void setLink_merchantCode(String link_merchantCode) {
		this.link_merchantCode = link_merchantCode;
	}

	/**
	 * 财务状态（欠款、部份欠款、结清）
	 */
	private String finance_status;

	/**
	 * 成人人数（冗余）
	 */
	private Integer adult_num;

	/**
	 * 儿童人数（冗余）
	 */
	private Integer children_num;

	/**
	 * 婴儿人数（冗余）
	 */
	private Integer inf_num;

	/**
	 * 订单总价（冗余）
	 */
	private Double order_all_price;

	/**
	 * 总销售价（不含税）（冗余）
	 */
	private Double sale_price;

	/**
	 * 总税（无税产品为0）（冗余）
	 */
	private Double tax;

	/**
	 * 保险总价（冗余）
	 */
	private Double i_price;

	/**
	 * 总快递费（冗余）
	 */
	private Double express_price;

	/**
	 * 总服务费（冗余）
	 */
	private Double service_price;

	/**
	 * 其他收费（收为正数，支为负）（冗余）
	 */
	private Double other_price;

	/**
	 * 联系人
	 */
	private String contact;

	/**
	 * 联系人电话
	 */
	private String telephone;

	/**
	 * 联系人手机号
	 */
	private String phone_number;

	/**
	 * 联系人地址
	 */
	private String address;

	/**
	 * 是否锁定
	 */
	private Integer is_lock;

	/**
	 * 锁定人
	 */
	private String lock_user;

	/**
	 * 是否审核（订单、财务、帐单全部核对的结果）
	 */
	private Integer is_examine;

	/**
	 * 订单是否有效（删除）
	 */
	private Integer is_effect;

	/**
	 * 补充信息（json）
	 */
	private String remark;

	/**
	 * 审核人
	 */
	private String examine_er;
	

	/**
	 * 审核时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date examine_time;
	
	/**
	 * 生效时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date start_datetime;
	
	/**
	 * 失效时间 
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date end_datetime;
	
	/**
	 * 是否使用发票0否1是
	 */
	private Integer is_receipt;
	
	/**
	 * 保险数量
	 */
	private Integer i_num;
	
	/**
	 * 客规,机票专用
	 */
	private String flight_regulation;
	
	
	

	/**
	 * @return flight_regulation
	 */
	
	public String getFlight_regulation() {
		return flight_regulation;
	}

	/**
	 * @param paramtheparamthe{bare_field_name} to set
	 */
	
	public void setFlight_regulation(String flight_regulation) {
		this.flight_regulation = flight_regulation;
	}

	/**
	 * @return i_num
	 */
	
	public Integer getI_num() {
		return i_num;
	}

	/**
	 * @param paramtheparamthe{bare_field_name} to set
	 */
	
	public void setI_num(Integer i_num) {
		this.i_num = i_num;
	}

	/**
	 * @return is_receipt
	 */
	
	public Integer getIs_receipt() {
		return is_receipt;
	}

	/**
	 * @param paramtheparamthe{bare_field_name} to set
	 */
	
	public void setIs_receipt(Integer is_receipt) {
		this.is_receipt = is_receipt;
	}

	/**
	 * @return start_datetime
	 */
	
	public Date getStart_datetime() {
		return start_datetime;
	}

	/**
	 * @param paramtheparamthe{bare_field_name} to set
	 */
	
	public void setStart_datetime(Date start_datetime) {
		this.start_datetime = start_datetime;
	}

	/**
	 * @return end_datetime
	 */
	
	public Date getEnd_datetime() {
		return end_datetime;
	}

	/**
	 * @param paramtheparamthe{bare_field_name} to set
	 */
	
	public void setEnd_datetime(Date end_datetime) {
		this.end_datetime = end_datetime;
	}

	public void setBusines_order_id(Integer busines_order_id) {
		this.busines_order_id = busines_order_id;
	}

	public Integer getBusines_order_id() {
		return this.busines_order_id;
	}

	public void setOrder_code(String order_code) {
		this.order_code = order_code;
	}

	public String getOrder_code() {
		return this.order_code;
	}

	public void setCreate_date(Date create_date) {
		this.create_date = create_date;
	}

	public Date getCreate_date() {
		return this.create_date;
	}

	public void setOrder_time(Date order_time) {
		this.order_time = order_time;
	}

	public Date getOrder_time() {
		return this.order_time;
	}

	public void setBusines_species(String busines_species) {
		this.busines_species = busines_species;
	}

	public String getBusines_species() {
		return this.busines_species;
	}

	public void setMerchant_code(String merchant_code) {
		this.merchant_code = merchant_code;
	}

	public String getMerchant_code() {
		return this.merchant_code;
	}

	public void setSource(String source) {
		this.source = source;
	}

	public String getSource() {
		return this.source;
	}

	public void setCid_merchant(String cid_merchant) {
		this.cid_merchant = cid_merchant;
	}

	public String getCid_merchant() {
		return this.cid_merchant;
	}

	public void setCustomer_id(String customer_id) {
		this.customer_id = customer_id;
	}

	public String getCustomer_id() {
		return this.customer_id;
	}

	public void setOrder_status(String order_status) {
		this.order_status = order_status;
	}

	public String getOrder_status() {
		return this.order_status;
	}

	public void setOrder_tag(String order_tag) {
		this.order_tag = order_tag;
	}

	public String getOrder_tag() {
		return this.order_tag;
	}

	public void setFinance_status(String finance_status) {
		this.finance_status = finance_status;
	}

	public String getFinance_status() {
		return this.finance_status;
	}

	public void setAdult_num(Integer adult_num) {
		this.adult_num = adult_num;
	}

	public Integer getAdult_num() {
		return this.adult_num;
	}

	public void setChildren_num(Integer children_num) {
		this.children_num = children_num;
	}

	public Integer getChildren_num() {
		return this.children_num;
	}

	public void setInf_num(Integer inf_num) {
		this.inf_num = inf_num;
	}

	public Integer getInf_num() {
		return this.inf_num;
	}

	public void setOrder_all_price(Double order_all_price) {
		this.order_all_price = order_all_price;
	}

	public Double getOrder_all_price() {
		return this.order_all_price;
	}

	public void setSale_price(Double sale_price) {
		this.sale_price = sale_price;
	}

	public Double getSale_price() {
		return this.sale_price;
	}

	public void setTax(Double tax) {
		this.tax = tax;
	}

	public Double getTax() {
		return this.tax;
	}

	public void setI_price(Double i_price) {
		this.i_price = i_price;
	}

	public Double getI_price() {
		return this.i_price;
	}

	public void setExpress_price(Double express_price) {
		this.express_price = express_price;
	}

	public Double getExpress_price() {
		return this.express_price;
	}

	public void setService_price(Double service_price) {
		this.service_price = service_price;
	}

	public Double getService_price() {
		return this.service_price;
	}

	public void setOther_price(Double other_price) {
		this.other_price = other_price;
	}

	public Double getOther_price() {
		return this.other_price;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	public String getContact() {
		return this.contact;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public String getTelephone() {
		return this.telephone;
	}

	public void setPhone_number(String phone_number) {
		this.phone_number = phone_number;
	}

	public String getPhone_number() {
		return this.phone_number;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getAddress() {
		return this.address;
	}

	public void setIs_lock(Integer is_lock) {
		this.is_lock = is_lock;
	}

	public Integer getIs_lock() {
		return this.is_lock;
	}

	public void setLock_user(String lock_user) {
		this.lock_user = lock_user;
	}

	public String getLock_user() {
		return this.lock_user;
	}

	public void setIs_examine(Integer is_examine) {
		this.is_examine = is_examine;
	}

	public Integer getIs_examine() {
		return this.is_examine;
	}

	public void setIs_effect(Integer is_effect) {
		this.is_effect = is_effect;
	}

	public Integer getIs_effect() {
		return this.is_effect;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getRemark() {
		return this.remark;
	}

	public void setExamine_er(String examine_er) {
		this.examine_er = examine_er;
	}

	public String getExamine_er() {
		return this.examine_er;
	}

	public void setExamine_time(Date examine_time) {
		this.examine_time = examine_time;
	}

	public Date getExamine_time() {
		return this.examine_time;
	}

	/**
	 * 
	 * @Title: Init
	 * @Description: TODO(初始化订单数据)
	 * @param @param map
	 * @param @return 参数
	 * @return PublicOrders 返回类型
	 * @throws
	 */
	public static PublicOrders Init(Map<String, Object> map,
			PublicOrdersAllModel model) {
		PublicOrders porders = new PublicOrders();
		// 生成订单号，需要拿到业务种类，商家标识，业务类型等字符串，然后组装年月日时分秒+三位计数器
		porders.setOrder_code(model.getOrder_code());
		porders.setCreate_date(new Date());
		porders.setOrder_status(model.getOrder_status());
		porders.setOrder_time(model.getOrder_time());
		porders.setIs_effect(1);
		porders.setBusines_species(model.getBusines_species());
		porders.setLink_merchantCode(model.getLink_merchantCode());
		porders.setLink_type(model.getLink_type());
		if(CommonUtil.isEmpty(model.getOther_price()))
			porders.setOther_price(0d);
		else
			porders.setOther_price(model.getOther_price());
		porders.setMerchant_code(model.getMerchant_code());
		porders.setSource(model.getSource());
		porders.setCid_merchant(model.getCid_merchant());

		porders.setCustomer_id(model.getCustomer_id());
		porders.setOrder_status(model.getOrder_status());
		porders.setFinance_status(model.getFinance_status());
		porders.setAdult_num(model.getAdult_num());
		porders.setChildren_num(model.getChildren_num());

		porders.setInf_num(model.getInf_num());
		// 价格相关
		porders.setOrder_all_price(model.getOrder_all_price());
		porders.setSale_price(model.getSale_price());
		porders.setTax(model.getTax());

		if (CommonUtil.isNotEmpty(model.getI_price()))
			porders.setI_price(model.getI_price());
		else
			porders.setI_price(0d);
		if (CommonUtil.isNotEmpty(model.getExpress_price()))
			porders.setExpress_price(model.getExpress_price());
		else
			porders.setExpress_price(0d);

		if (CommonUtil.isNotEmpty(model.getService_price()))
			porders.setService_price(model.getService_price());
		else
			porders.setService_price(0d);
		if (CommonUtil.isNotEmpty(model.getOther_price()))
			porders.setOther_price(model.getOther_price());
		else
			porders.setOther_price(0d);

		porders.setContact(model.getContact());
		porders.setTelephone(model.getTelephone());
		porders.setPhone_number(model.getPhone_number());
		porders.setAddress(model.getAddress());

		porders.setIs_lock(0);// 锁定相关
		porders.setLock_user(model.getLock_user());
		if(CommonUtil.isEmpty(model.getIs_examine()))
			porders.setIs_examine(0);// 审核相关
		else
			porders.setIs_examine(model.getIs_examine());
		if(CommonUtil.isEmpty(model.getExamine_er()))
			porders.setExamine_er("");
		else
			porders.setExamine_er(model.getExamine_er());
		if(CommonUtil.isNotEmpty(model.getStart_datetime()))
			porders.setStart_datetime(model.getStart_datetime());
		if(CommonUtil.isNotEmpty(model.getEnd_datetime()))
			porders.setEnd_datetime(model.getEnd_datetime());
		porders.setExamine_time(null);

		porders.setRemark(null);
		if(CommonUtil.isNotEmpty(model.getIs_receipt()))
			porders.setIs_receipt(model.getIs_receipt());
		else
			porders.setIs_receipt(0);
		if(CommonUtil.isNotEmpty(model.getFlight_regulation()))
			porders.setFlight_regulation(model.getFlight_regulation());

		return porders;
	}
	
	private String status_name;
	private String o_station;
	private String o_time;
	private String o_name;
	public String getO_station() {
		return o_station;
	}

	public void setO_station(String o_station) {
		this.o_station = o_station;
	}

	public String getO_time() {
		return o_time;
	}

	public void setO_time(String o_time) {
		this.o_time = o_time;
	}

	public String getO_name() {
		return o_name;
	}

	public void setO_name(String o_name) {
		this.o_name = o_name;
	}

	public String getStatus_name() {
		return status_name;
	}

	public void setStatus_name(String status_name) {
		this.status_name = status_name;
	}
	private Object group;  //额外业务参数

	public Object getGroup() {
		return group;
	}

	public void setGroup(Object group) {
		this.group = group;
	}
	
}
